package com.dshore.messagecenter.controller.technology;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.dshore.messagecenter.service.technology.TimerTaskService;

/**
 * 定时任务
 * @author panyi-com
 *
 */
@Component
@Controller
@RequestMapping("/index")
public class TimerController {
	
	@Autowired
	private TimerTaskService timerTaskService;
	
	//定时任务 30秒执行一次
	@Scheduled(cron="0 0 0,18 * * ?") 
	//@Scheduled(cron="*/5 * * * * ?") 
	public ModelAndView timerTask() {
		ModelAndView mv=new ModelAndView("emial");
		Integer r=timerTaskService.addData();
		System.out.println("定时任务："+r);
		return mv;
	}	

}
